package com.qf.lanzhou.blog.api.service.impl;

import com.qf.lanzhou.blog.api.dao.Impl.ReplyDaoImpl;
import com.qf.lanzhou.blog.api.dao.ReplyDao;
import com.qf.lanzhou.blog.api.service.ReplyService;

import java.util.List;

/**
 * @author 是柠檬甜
 * @ClassName ReplyServiceImpl
 * @description 回复数据服务层接口实现类
 * @date 2020/12/18 15:46
 * @modifier 是柠檬甜
 * @date 2020-12-18 15:46
 * @Version V1.0
 */
public class ReplyServiceImpl implements ReplyService {
    private ReplyDao replyDao = new ReplyDaoImpl();

    @Override
    public List selectReply(Long commentId, Long articleId) {
        List replyList = replyDao.select(commentId, articleId);
        System.out.println(":replyList"+replyList);
        return replyList;
    }

    @Override
    public Boolean addReply(Long commentId, Long articleId, String replyContent,String replyUserName) {
        Boolean result = replyDao.insert(commentId, articleId, replyContent,replyUserName);
        if (!result) {
            throw new RuntimeException("系统繁忙，回复失败");
        }
        return true;
    }
}
